package com.nightsoul.groovy

import groovy.lang.GroovyInterceptableimport java.io.Writerimport java.io.PrintWriterimport java.lang.Systemimport org.codehaus.groovy.runtime.InvokerHelperimport groovy.xml.MarkupBuilderpublic class MetaClassTest{

	public static void main(def args){
		def wt = new Whater();
		println wt.inner();
		
	}
	
	
	
}

class Traceable implements GroovyInterceptable {
	
	Object invokeMethod(String name, Object args) {
		//println "before method";
		System.out.println("before method");
		def metaClass = InvokerHelper.getMetaClass(this.class);
		def result = metaClass.invokeMethod(this, name, args);
		//println "after method";
		System.out.println("after method");
		return result;
	}
}

class Whater extends Traceable {
	int outer() {
		return inner();
	}
	
	int inner() {
		return 1;
	}
}